<template>
    <div>
        <Draewr 
        direction='ltr' 
        size='30%' 
        bgColor='rgba(25, 23, 85,0.6)' 
        :wrapperClosable=true
        >
        <template #conte>
            <div>
                <ul>
                    <li><router-link to="button">按钮</router-link></li>
                    <li><router-link to="testFive">testFive</router-link></li>
                    <li><router-link to="swiper">swiper</router-link></li>
                </ul>
            </div>
            
        </template>        
        </Draewr>

        <div class="mainbody middle" :class="{middleflip:flag}">
    <form class="form-box front">
      <div>
        <h2>Login</h2>
      </div>
      <div>
        <input class="input-normal" type="text" placeholder="UserAccount" />
        <input class="input-normal" type="password" placeholder="PassWord" />
        <button class="btn-submit" type="submit">
          LOGIN
        </button>
      </div>
      <div>
        <p style="margin-top: 40px">If you don't have account.Please</p>
        <p>Click here to <a id="signin" @click="Sign">Sign Up</a></p>
      </div>
    </form>
    <!-- 对的你没看错，上下两个表单基本上没区别，一个front，一个back -->
    <form class="form-box back">
      <div>
        <h2>Register</h2>
      </div>
      <div>
        <input class="input-normal" type="text" placeholder="UserAccount" />
        <input class="input-normal" type="password" placeholder="PassWord" />
        <button class="btn-submit" type="submit">
          Register
        </button>
      </div>
      <div>
        <p style="margin-top: 40px">Have a account ? You can</p>
        <p>Click here to <a id="login" @click="Sign">Log in</a></p>
      </div>
    </form>
  </div>
    </div>
</template>

<script>
import Draewr from '../../components/drawer.vue'
    export default {
        components:{
            Draewr
        },
        data() {
            return {
               flag:false 
            }
        },
        methods: {
            Sign(){
                this.flag = !this.flag
            }
        },
    }
</script>

<style scoped>
a{
    color: #fff;
    border: none;
}
ul li{
    margin: 20px 0;
}
/*主要是规定中间表单尺寸，调整到自己觉得好看就行了*/
.mainbody {
  height: 440px;
  width: 400px;
  perspective: 600px;
}

/*居中效果*/
.middle {
  /*使左上角对应到父元素的中心*/
  top: 50%;
  left: 50%;
  position: absolute;
  /*向左向上偏移50%*/
  transform: translate(-50%, -50%);
}

.form-box {
  width: 100%;
  height: 100%;
  margin: auto;
  background: darkcyan;
  /* 我觉得这个圆角大小刚刚好 */
  border-radius: 40px;
}

.input-normal {
  width: 220px;
  height: 38px;
  margin: 30px auto;
  padding: 0;
  text-align: center;
  border-radius: 20px;
  outline: none;
  display: block;
  transition: 0.3s;
  border: 1px solid #e6e6e6;
}

.btn-submit {
  width: 100px;
  height: 36px;
  margin: auto;
  font-size: 18px;
  text-align: center;
  color: white;
  border-radius: 20px;
  display: block;
  background: darkslategrey;
  transition: 0.3s;
}

.front {
  transform: rotateY(0deg);
}

/* 将back旋转180度，背面朝向用户，我这边选y轴的 */
.back {
  transform: rotateY(-180deg);
  background: rgb(48, 162, 238);
}

.front,
.back {
  position: absolute;
  /* 然后设置为背面朝向用户时不可见 */
  backface-visibility: hidden;
  /* 我觉得用linear顺滑一点 */
  transition: 0.3s linear;
}

/* 将front旋转180度 */
.middleflip .front {
  transform: rotateY(180deg);
}
/* 将back旋转180度 */
.middleflip .back {
  transform: rotateY(0deg);
}

/* 我调整了一下，感觉还不错的样式，你可以改成其他的好看点的 */
p {
  margin: 15px auto;
  padding: 0;
  font-size: 16px;
  color: white;
  display: block;
  text-align: center;
}
a {
  color: aqua;
  cursor: pointer;
}
</style>